#include <iostream>
#include <set>
using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    
    set<int> uniqueNumbers;  // set自动去重并按从小到大排序
    
    // 读取n个数并插入set中
    for (int i = 0; i < n; i++) {
        int num;
        cin >> num;
        uniqueNumbers.insert(num);
    }
    
    // 输出最小的k个不同数字
    int count = 0;
    for (auto it = uniqueNumbers.begin(); it != uniqueNumbers.end() && count < k; it++, count++) {
        if (count > 0) cout << " ";
        cout << *it;
    }
    cout << endl;
    
    return 0;
}